import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;

public class Test04 {
    public static void main(String[] args) {
        ArrayList<String> list=new ArrayList<>();
        Collections.addAll(list,"张无忌,15","周芷若,14","赵敏,13","张强,20","张三丰,100","张翠山,30","张良,35","王二麻子,31");
        List<Student> newList=list.stream().map(new Function<String,Student>(){
            @Override
            public Student apply(String s){
                String[] arr=s.split(",");
                String name=arr[0];
                int age=Integer.parseInt(arr[1]);
                return new Student(name,age);

            }
        }).collect(Collectors.toList());
        List<Student> newlist=list.stream().map(Student::new).collect(Collectors.toList());
        System.out.println(newlist);
//        System.out.println(newList);
    }
}
